<?php

if( send_mail($_GET["to"], $_GET["name"]." has been playing Little Man, and wants you to try it. Give it a shot at http://raws.adc.rmit.edu.au/~s3155488/\r\n\r\n", "Little Man - The Swinging Flash Game", $_GET["from"], $_GET["name"]) )
{
	echo "<hr><h2>Thanks!</h2><p>Thanks for spreading the word. Now play some more, or tell more people...</p>";
} else {
	echo "0";
}

function send_mail($to, $body, $subject, $fromaddress, $fromname, $attachments=false)
{
  $eol="\r\n";
  $mime_boundary=md5(time());

  # Common Headers
  $headers .= "From: ".$fromname."<".$fromaddress.">".$eol;
  $headers .= "Reply-To: ".$fromname."<".$fromaddress.">".$eol;
  $headers .= "Return-Path: ".$fromname."<".$fromaddress.">".$eol;    // these two to set reply address
  $headers .= "Message-ID: <".time()."-".$fromaddress.">".$eol;
  //$headers .= "X-Mailer: PHP v".phpversion().$eol;          // These two to help avoid spam-filters

  # Boundry for marking the split & Multitype Headers
  //$headers .= 'MIME-Version: 1.0'.$eol.$eol;
//  $headers .= "Content-Type: multipart/mixed; boundary=\"".$mime_boundary."\"".$eol.$eol;

  # Open the first part of the mail
  $msg = $body;

  # SEND THE EMAIL
  ini_set(sendmail_from,$fromaddress);  // the INI lines are to force the From Address to be used !
  $mail_sent = mail($to, $subject, $msg, $headers);
  
  ini_restore(sendmail_from);
  
  return $mail_sent;
}

?>